<!DOCTYPE html>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<iframe src="resources/form-associated-state-restore-frame.html"></iframe>
<script>

let t = async_test('Form-associated custom elements can restore their values on back-forward navigation');

function doneTest() {
  t.step(() => {
    let d = document.querySelector('iframe').contentDocument;
    assert_equals(d.querySelector('my-control-1').value, 'edit1');
    assert_equals(d.querySelector('my-control-1').lastRestoreMode, 'restore');
    assert_equals(d.querySelector('my-control-2').value, 'edit2');
    assert_equals(d.querySelector('my-control-2').lastRestoreMode, 'restore');
    assert_equals(d.querySelector('#focus').value, 'initial');
    assert_equals(d.querySelector('#nested-focus').value, 'initial');
    assert_equals(d.querySelector('#disabled').value, 'initial');
    assert_equals(d.querySelector('#readonly').value, 'initial');
    assert_equals(d.querySelector('#fieldset-disabled').value, 'initial');
    t.done();
  });
}
</script>
</body>
